.timeline-container {
  position: relative;
  width: 100%;
  overflow-x: hidden; /* Hide scrollbar by default */
  background: #fff;
  border-radius: 8px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;

  .timeline-scroll-area {
    /* New wrapper for scrollable content */
    width: 100%;
    overflow-x: hidden; /* Default hidden scrollbar */
    // padding: 0 50px; /* Padding for fade effects */
    box-sizing: border-box;
    position: relative; /* For timeline-line */
    min-height: 250px; /* Minimum height to accommodate card below the line */

    &.show-scroll-buttons {
      overflow-x: scroll; /* Show scrollbar when needed */
    }
  }

  .timeline-line {
    position: absolute;
    height: 2px;
    border-top: 2px dashed #e8e8e8; /* Dashed line */
    left: 0; /* Relative to timeline-scroll-area */
    right: 0; /* Relative to timeline-scroll-area */
    top: 30px; /* Position relative to timeline-scroll-area */
    z-index: 0;
  }

  .timeline-wrapper {
    display: inline-flex;
    flex-wrap: nowrap;
    position: relative;
    align-items: flex-start; /* Ensure items align to top after padding */
    padding: 0 30px;
    padding-bottom: 60px;
  }

  .timeline-item {
    flex: 0 0 auto;
    width: 320px;
    margin-right: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    top: 30px;

    &:last-child {
      margin-right: 0;
    }

    .timeline-dot {
      position: absolute;
      top: 0px; /* Position dot relative to the top of the item, so it aligns with the line */
      width: 20px;
      height: 20px;
      background: #ffffff;
      border: 2px solid #d9d9d9;
      border-radius: 50%;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      transform: translateY(-50%);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
      z-index: 1;

      &::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 6px;
        height: 6px;
        background: #d9d9d9;
        border-radius: 50%;
        transition: all 0.3s ease;
      }

      &.active {
        // transform: scale(1.2) translateX(-50%);
        border-color: #1890ff;
        box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.2);
        animation: breathe 1.5s infinite alternate; /* Breathing light effect */

        &::before {
          background: #1890ff;
          width: 8px;
          height: 8px;
        }
      }
    }

    .timeline-card-container {
      width: 280px;
      background: #ffffff;
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      border: 1px solid #e8e8e8;
      overflow: hidden;
      position: relative;
      z-index: 1;
      margin-top: 30px; /* Space between dot and card */

      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
      }

      &.active {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(24, 144, 255, 0.15);
        border-color: #1890ff;

        .timeline-card-header {
          color: #1890ff;
          font-weight: 600;
        }
      }

      .timeline-card {
        height: 184px; /* Fixed height for the card */
        display: flex;
        flex-direction: column;
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
        position: relative;
      }

      .timeline-card-header {
        font-size: 16px;
        font-weight: 500;
        color: #262626;
        padding: 8px 16px;
        border-bottom: 1px solid #f0f0f0;
        transition: color 0.3s ease;
        display: flex;
        justify-content: space-between; /* Space between title and date */
        align-items: center;

        span.title {
          flex-shrink: 0;
        }

        span.datetime-header {
          /* Style for datetime in header */
          font-size: 12px;
          color: #8c8c8c;
          margin-left: 10px;
        }
      }

      .timeline-card-details {
        flex: 1;
        font-size: 14px;
        color: #595959;
        line-height: 1.6;
        overflow-y: auto; /* Enable scrollbar */
        height: 100px; /* Fixed height for details */
        padding: 8px;

        &::-webkit-scrollbar {
          width: 6px;
        }

        &::-webkit-scrollbar-track {
          background: #f1f1f1;
          border-radius: 10px;
        }

        &::-webkit-scrollbar-thumb {
          background: #888;
          border-radius: 10px;
        }

        &::-webkit-scrollbar-thumb:hover {
          background: #555;
        }

        /* Remove p styling as content will be in a single div */
      }

      .timeline-datetime {
        /* This will be removed from JSX later */
        display: none;
      }
    }
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .timeline-card-container {
    animation: fadeIn 0.5s ease-out forwards;
  }

  @media screen and (max-width: 768px) {
    .timeline-card-container {
      width: 240px !important;
    }

    .timeline-card-header {
      font-size: 14px;
    }

    .timeline-card-details {
      font-size: 12px;
    }
  }
}

.scroll-buttons-timeline {
  position: absolute;
  bottom: 10px; /* Position at the bottom of the container */
  right: 50px; /* Fixed to the right within container */
  display: flex;
  gap: 10px;
  z-index: 3;

  button {
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;

    &:disabled {
      background: #e8e8e8;
      cursor: not-allowed;
    }
    img {
      width: 18px;
      height: 18px;
    }
  }
}

@keyframes breathe {
  0% {
    box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(24, 144, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.2);
  }
}
